import os

def check_null_bytes(directory):
    for root, dirs, files in os.walk(directory):
        for file in files:
            if file.endswith('.py'):
                path = os.path.join(root, file)
                with open(path, 'rb') as f:
                    content = f.read()
                    if b'\x00' in content:
                        print(f"发现空字节文件: {path}")

check_null_bytes('E:\geosystem')  # 替换为你的项目路径
